fix: correct player spawn in 1.20.1-#35
Conversation
WalkthroughThe changes refactor spawn packet creation in the entity wrapper classes. The base entity class now uses a helper method for packet creation, with a generalized return type. The player wrapper class overrides this method to implement version-specific logic for packet creation and adds an extended spawn packet list including rotation and head look packets, ensuring compatibility with different server versions. Changes
Sequence Diagram(s)sequenceDiagram
participant Server
participant WrapperEntity
participant WrapperPlayer
participant PacketWrapper
Server->>WrapperEntity: spawn(location, parent)
WrapperEntity->>WrapperEntity: createSpawnPacket()
alt Entity is Player and version <= 1.20.1
WrapperEntity->>WrapperPlayer: createSpawnPacket()
WrapperPlayer->>PacketWrapper: create WrapperPlayServerSpawnPlayer packet
else Entity is Player and version > 1.20.1
WrapperEntity->>PacketWrapper: createSpawnPacket() (superclass logic)
else Other Entity
WrapperEntity->>PacketWrapper: createSpawnPacket()
end
WrapperPlayer->>WrapperPlayer: createSpawnPackets()
WrapperPlayer->>PacketWrapper: add rotation and head look packets
WrapperEntity->>Server: Send PacketWrapper(s)
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
By the way, the project's dependency on packetevents seems quite old. The latest version of EntityData has added generic type support. |
Due to some unforeseen stuff with my irl work (I've explained in the Discord) I've not had a lot of time to work on EntityLib as i had months prior. Though the generic boxing doesn't really affect us |
|
LGTM 👍🏿 Thank you for your pull request |
Summary by CodeRabbit
New Features
Refactor